Computes and draws kernel density estimate and convert it into ggplotly
p <-
ggplot(diamonds, aes(carat)) +
geom_density()
plotly::ggplotly(p)
p <-
ggplot(diamonds, aes(y = carat)) +
geom_density()
plotly::ggplotly(p)
## Error in data.frame(..., check.names = FALSE): arguments imply differing number of rows: 512, 0
p <-
ggplot(diamonds, aes(carat)) +
geom_density(adjust = 1/5)
plotly::ggplotly(p)
p <-
ggplot(diamonds, aes(carat)) +
geom_density(adjust = 5)
plotly::ggplotly(p)
p <-
ggplot(diamonds, aes(depth, colour = cut)) +
geom_density() +
xlim(55, 70)
plotly::ggplotly(p)
## Warning: Removed 45 rows containing non-finite values (stat_density).
p <-
ggplot(diamonds, aes(depth, fill = cut, colour = cut)) +
geom_density(alpha = 0.1) +
xlim(55, 70)
plotly::ggplotly(p)
## Warning: Removed 45 rows containing non-finite values (stat_density).
p <-
ggplot(diamonds, aes(carat, fill = cut)) +
geom_density(position = "stack")
plotly::ggplotly(p)
p <-
ggplot(diamonds, aes(carat, after_stat(count), fill = cut)) +
geom_density(position = "stack")
plotly::ggplotly(p)
p <-
ggplot(diamonds, aes(carat, after_stat(count), fill = cut)) +
geom_density(position = "fill")
plotly::ggplotly(p)